<?php
/**
 * ElectricitySendMessageMsgtpl寝室电费充值计划任务消息模板
 * @author hjc19850430@gmail.com
 */
class ElectricitySendMessageMsgtpl extends BaseMsgtpl
{
	/**
	* 给用户发消息
	*/
	public function sendMessageToUser($data,$template_id,$ele,$max_ele,$wechat){
		$this->wxTplSign = $template_id;
		
		$fans = D('Fans')->get($data['fans_id'],'openid,subscribe,wechat_id');
		$url = 'wap.xt.beescrm.com/'.U('base/electricity/index',array('wechat_id' => $data['wechat_id']));
		if ($fans['subscribe']) {
			$info = array(
				'first' => array("value" => '同学，你的寝室电量剩余不足'.$max_ele.'度', 'color' => '#173177'),
				'keynote1' => array("value" => $data['username']),
				'keynote2' => array("value" => $data['community_name'].$data['building_name'].$data['room'].'室', "color" => "#173177"),
				'keynote3' => array("value" => $ele, "color" => "#173177"),
				'remark' => array("value" => '请点此登录电费充值模块进行充值'),
			);

			$this->wxObj->messageTpl($wechat['appid'], $wechat['appsecret'], $fans['openid'], $this->wxTplSign, $info, $url);
		}
	}
}
